<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //将其他数据类型转化为数组
    //所有可遍历的 数组 字符串 set map NodeList arguments
    console.log(Array.from('asg'));
    console.log(Array.from(new Set([1,2,3])));
    //拥有length属性的任意对象
    const obj={0:'a',1:'b',length:3}
    console.log(Array.from(obj));
    //第二个参数 作用类似于数组的map方法，用来对每个数组进行处理，将处理后的值放入返回的数组
    console.log([1,2,3].map(value=>{return value*2}));
    console.log(Array.from('12',value=>value*2));
    //第三个参数 指定this指向
    Array.from('12',function(){console.log(this)},document)
  </script>
</body>
</html>